const { DataTypes } = require('sequelize');
const { sequelize } = require('../init'); // 导入数据库连接配置

// 审批表
const Approval = sequelize.define('Approval', {
    ApprovalID: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
        allowNull: false,
    },
    WorkOrderID: {
        type: DataTypes.INTEGER,
        allowNull: false,
        collate: 'utf8mb4_bin', // 设置字符集规则
    },
    ApproverUserID: {
        type: DataTypes.TEXT,
        allowNull: true,
        collate: 'utf8mb4_bin', // 设置字符集规则
    },
    ApprovalDate: {
        type: DataTypes.DATE,
        allowNull: true,
        collate: 'utf8mb4_bin', // 设置字符集规则
    },
    ApprovalStatus: {
        type: DataTypes.INTEGER,
        allowNull: true,
        collate: 'utf8mb4_bin', // 设置字符集规则
    }
}, {
    tableName: 'approval', // 设置表名为 "approval"
    timestamps: false, // 如果表中不包含 createdAt 和 updatedAt 字段，请将此选项设置为 false
    collate: 'utf8mb4_bin', // 设置字符集规则
});
// 帮我打印一下数据库连接情况
Approval.sync({ force: false }).then(() =>
{
    console.log('审批表准备');
});
module.exports = { Approval };
